<%@page contentType="text/html; charset=utf-8"%>
<script type="text/javascript">
	var $menuObj = {}, $tg_menu , $menu_window ;
	$(function() {
		$menuObj = {
			init: function() {
				$tg_menu = $('#tg_menu').treegrid({
					title: '菜单管理',
					url: '/menu/list', method: 'GET', idField: 'id', treeField: 'name',
					fit: true, border: false, rownumbers: true, rownumberWidth: 40, toolbar: "#toolbars_menu",
					frozenColumns: [[
						{title: 'ID', field: 'id', hidden: true},
						{title: '排序', field: 'orderNum', width: 50},
						{title: '菜单名称', field: 'name', width: 200}
					]],
					columns: [[
						{title: '状态', field: 'status', width: 60, align: 'center'},
						{title: '菜单代码', field: 'code', width: 80},
						{title: '权限代码', field: 'permission', width: 100},
						{title: 'URL', field: 'url', width: 400},
						{title: '菜单类型', field: 'type', width: 70},
						{title: '是否叶子', field: 'leaf', width: 70},
						{title: '图标', field: 'icon', width: 50},
						{title: 'frame', field: 'iniframe', width: 50},
					]]
				});
			},
			add: function() {
				$menu_window = MM.addWindow({title: '添加菜单', href: '/menu/form', width: 600, height: 320});
			},
			del: function() {
				var row = $tg_menu.treegrid('getSelected') ;
				alert("del=="+row.id);
			},
			update: function() {
				var row = $tg_menu.treegrid('getSelected') ;
				alert("update=="+row.id);
			},
			reload: function() {
				$tg_menu.treegrid('reload');
			}
		};
		
		$menuObj.init() ;
	});
</script>

<div id="tg_menu">
	<div id="toolbars_menu"> 
		<a onclick="$menuObj.add();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-add'">添加</a> 
		<a onclick="$menuObj.update();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-edit'">编辑</a> 
		<a onclick="$menuObj.del();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-cancel'">删除</a> 
		<a onclick="$menuObj.reload();" class="easyui-linkbutton" data-options="plain:true, iconCls:'icon-reload'">刷新</a> 
	</div>
</div>
